package com.css.zfzx.data.util;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKTReader;

/**
 * @Description: data
 * @Author: lhl
 * @CreateDate: 2021/4/27 9:34
 */
public class GeometryUtil {

    public static Geometry setRecArea(String polygonStr) {
        //WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326));
        WKTReader reader = new WKTReader();
        Geometry geom = null;
        try {
            geom = reader.read(polygonStr);
            geom.setSRID(4490);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return geom;
    }

    public static Geometry setRecAreaHddc(String polygonStr,int srid) {
        //WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4326));
        WKTReader reader = new WKTReader();
        Geometry geom = null;
        try {
            geom = reader.read(polygonStr);
            geom.setSRID(srid);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return geom;
    }
}
